<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>订单支付</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            font-family: Arial, sans-serif;
            background-color: #f7f7f7;
            margin: 0;
        }
        .payment-container {
            text-align: center;
            background-color: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        #payNowButton {
            padding: 10px 20px;
            background-color: #ff5000;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        #payNowButton:hover {
            background-color: #e04c00;
        }
    </style>
</head>
<body>
<div class="payment-container">
    <h1>订单支付</h1>
    <p>订单总金额: ¥<span id="totalAmount">0.00</span></p>
    <p>支付方式: 支付宝</p>
    <button id="payNowButton">立即支付</button>
</div>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
    $(document).ready(function() {
        // 获取URL参数
        const urlParams = new URLSearchParams(window.location.search);
        const orderId = urlParams.get('orderid');
        const price = urlParams.get('price');
        const title = urlParams.get('title');

        // 显示订单信息
        $('#totalAmount').text(parseFloat(price).toFixed(2));

        // 点击“立即支付”按钮
        $('#payNowButton').on('click', function() {
            const url = `/toPay?orderid=${orderId}&price=${price}&title=${encodeURIComponent(title)}`;
            window.location.href = url;
        });
    });
</script>
</body>
</html>
